<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;

class GetWechatAuthUrl extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'wechat:get_auth_url';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'get wechat auth url';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $appid = config('wechat.app_id');
        $scope = $this->anticipate('scope? snsapi_base or snsapi_userinfo', ['snsapi_base', 'snsapi_userinfo']);
        $url = $this->ask('url?');

        $this->info(get_wechat_auth_url($url, $scope));
    }
}
